Skip to content

feat: Added cloud.resource_id, faas.id and aws.lambda.invoked_arn rules for Otel Lambda relationships#3049

Open
Sashwatdas123 wants to merge 4 commits into
newrelic:mainfrom
Sashwatdas123:Otel/lambdas
Open

feat: Added cloud.resource_id, faas.id and aws.lambda.invoked_arn rules for Otel Lambda relationships#3049
Sashwatdas123 wants to merge 4 commits into
newrelic:mainfrom
Sashwatdas123:Otel/lambdas

Conversation

@Sashwatdas123

@Sashwatdas123 Sashwatdas123 commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Summary

OTel Lambda services (EXT-SERVICE) only link to their AWS Lambda entity via the manual newrelic.aws_metric_streams.arn attribute. OTel already emits the ARN automatically (e.g. aws.lambda.invoked_arn, cloud.resource_id, faas.id), but no rule used them. This PR adds native relationship rules keyed off those attributes, with a defined precedence order to avoid duplicate relationships. The manual rule is untouched — purely additive and backward compatible.

Changes

1. relationships/synthesis/EXT-SERVICE-to-INFRA-AWSLAMBDAFUNCTION.yml

Added 3 new rules (4 total). All share the function-ARN regex: ^arn:aws:lambda:([^:]*):([0-9]*):function:([^:]*)$

Rule Attribute Precedence Gates (present: false)
_Explicit (unchanged) newrelic.aws_metric_streams.arn None — always wins
_InvokedArn (new) aws.lambda.invoked_arn newrelic.aws_metric_streams.arn absent
_CloudResourceId (new) cloud.resource_id newrelic.aws_metric_streams.arn + aws.lambda.invoked_arn absent
_FaasId (new) faas.id All higher-priority attributes absent

2. relationships/synthesis/EXT-SERVICE-to-INFRA-AWSLAMBDAALIAS.yml

Same 4-rule structure with alias-ARN regex: ^arn:aws:lambda:([^:]*):([^:]*):function:([^:]*):([^/]*)$

3. entity-types/ext-service/definition.yml (rule ext_service_service_name_3)

Tag Change
telemetry.sdk.version + ttl: P1D
service.namespace + ttl: P1D
faas.name + ttl: P1D
faas.id + ttl: P1D
aws.lambda.invoked_arn New tag mapping + ttl: P1D

Precedence Design

Uses cascading present: false conditions so only one rule fires per datapoint, preventing duplicate relationships:

Priority order: Manual (aws_metric_streams.arn) → aws.lambda.invoked_arncloud.resource_idfaas.id

Rationale: Intent > Specificity > Recency > Legacy

  1. Manual — explicit customer intent, always honored
  2. aws.lambda.invoked_arn — OTel attribute purpose-built for Lambda, preserves full invoked ARN including alias/version
  3. cloud.resource_id — modern OTel generic cloud resource identifier
  4. faas.id — legacy OTel FaaS attribute, superseded but still emitted by older instrumentation

In practice each language emits exactly one attribute, so precedence is a safety measure:

  • Goaws.lambda.invoked_arn (its only ARN attribute)
  • Java/JS/Pythoncloud.resource_id
  • .NET/legacyfaas.id

Notes

ARB

ARB ticket: https://new-relic.atlassian.net/browse/NR-590700

@entityBot entityBot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

beep boop bop.

I have found some errors processing these changes:

  • No valid, approved ARB ticket found in the PR description. This PR has to be reviewed by the API Review Board, please include a link to the ticket of that review in the PR description. Check how to start the process here or reach #api-review-board channel in case of doubts

@entityBot
entityBot requested review from a team July 15, 2026 05:01
@Sashwatdas123 Sashwatdas123 changed the title Otel/lambdas feat: Add cloud.resource_id and faas.id rules for AWS Lambda relationships Jul 15, 2026
@Sashwatdas123 Sashwatdas123 changed the title feat: Add cloud.resource_id and faas.id rules for AWS Lambda relationships feat: Added cloud.resource_id and faas.id rules for AWS Lambda relationships Jul 17, 2026
@Sashwatdas123 Sashwatdas123 changed the title feat: Added cloud.resource_id and faas.id rules for AWS Lambda relationships feat: Added cloud.resource_id, faas.id and aws.lambda.invoked_arn rules for Otel Lambda relationships Jul 17, 2026
Comment on lines +29 to +34
- name: extServiceCallsAwsLambdaAlias_CloudResourceId
version: "1"
origins:
- Distributed Tracing
- OpenTelemetry
conditions:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the plan I shared, the new rules should have the following precedence:

  1. Manual newrelic.aws_metric_streams.arn (highest — explicit customer intent)
  2. aws.lambda.invoked_arn — preferred native, because it is the attribute defined to carry the full (alias-preserving) ARN
  3. cloud.resource_id
  4. faas.id (legacy native)

As the PR currently stands, it's possible for multiple rules to match in the event that the datapoint contains more than one of these attributes.

To resolve this, you need additional conditions on each of these rules in order to enforce the precedence.

So, for example, this rule matching cloud.resource_id should be gated on:

- attribute: aws.lambda.invoked_arn
  present: false
- attribute: newrelic.aws_metric_streams.arn
  present: false

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For completeness, here's how things should be gated for the other rules

  • _InvokedArn: newrelic.aws_metric_streams.arn → present: false
  • _CloudResourceId: aws.lambda.invoked_arn + newrelic.aws_metric_streams.arn → present: false
  • _FaasId: cloud.resource_id + aws.lambda.invoked_arn + newrelic.aws_metric_streams.arn → present: false

Same conditions applies to the three rules in the other file as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants